{\rtf1\ansi\deff0\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset0 Times New Roman;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Times New Roman;}{\f4\fswiss\fprq2\fcharset128 Microsoft Sans Serif;}{\f5\fswiss\fprq2\fcharset0 Arial Unicode MS;}{\f6\fnil\fprq2\fcharset0 MS Mincho;}{\f7\fnil\fprq0\fcharset0 Tahoma;}}
{\colortbl;\red0\green0\blue0;\red128\green128\blue128;}
{\stylesheet{\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\snext1 Normal;}
{\s2\sb240\sa120\keepn\rtlch\af2\afs28\lang255\ltrch\dbch\af6\langfe255\hich\f2\fs28\lang1033\loch\f2\fs28\lang1033\sbasedon1\snext3 Heading;}
{\s3\sa120\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon1\snext3 Body Text;}
{\s4\sa120\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon3\snext4 List;}
{\s5\sb120\sa120\rtlch\af7\afs24\lang255\ai\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\i\loch\fs24\lang1033\i\sbasedon1\snext5 caption;}
{\s6\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033\sbasedon1\snext6 Index;}
{\s7\sb120\sa120\rtlch\afs24\lang255\ai\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\i\loch\fs24\lang1033\i\sbasedon1\snext7 caption;}
}
{\info{\creatim\yr2011\mo7\dy19\hr6\min24}{\revtim\yr0\mo0\dy0\hr0\min0}{\printim\yr0\mo0\dy0\hr0\min0}{\comment StarWriter}{\vern3000}}\deftab709
{\*\pgdsctbl
{\pgdsc0\pgdscuse195\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Standard;}}
{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
\pard\plain \ltrpar\s1\ql\rtlch\af4\afs20\lang255\ltrch\dbch\af5\langfe255\hich\f4\fs20\lang1033\loch\f4\fs20\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Content;}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\f4\fs20\lang1033\loch\f4\fs20\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Core;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Graphics;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Math;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Scene;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Scene.Extension;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 using Tesla.Scene.Shape;}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\f4\fs20\lang1033\loch\f4\fs20\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 namespace TeslaSamples.Renderer \{}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 [AppDescription("Render to texture", PlatformCapabilities.Direct3D10 | PlatformCapabilities.XNA4, "RenderTargetImage", "RenderTargetDesc", "RenderTargetSource")]}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 public class RenderTargetSample : BasicApp \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 private RenderTarget2D _renderTarget;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 private Camera _targetCamera;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 private Box _offscreenCube;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 private Box _box;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 protected override void LoadContent() \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 Window.Title = "Render Target Sample";}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Create the box we'll render off screen}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube = new Box("Offscreen box", 10, 10, 10);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.Material = ContentManager.Load<Material>("LitBasicTexture.tem");}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.Material.SetParameter("DiffuseMap", ContentManager.Load<Texture2D>("Textures//rock_diff.dds"));}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.AddController(new RotateController(Vector3.Normalize(Vector3.Add(Vector3.Up, Vector3.Right)), 45.0f));}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 PointLight pl = new PointLight();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 pl.Diffuse = Color.CornflowerBlue;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 pl.Position = new Vector3(0, 25, 25);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 pl.Ambient = Color.LightBlue;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.AddLight(pl);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.SceneHints.LightCombineHint = LightCombineHint.Local;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.RenderBucketType = RenderBucketType.Skip;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Create a render target that also has a depth stencil.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _renderTarget = new RenderTarget2D(512, 512, true, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Camera we'll use for the off screen rendering}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _targetCamera = new Camera(new Viewport(0, 0, 512, 512));}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _targetCamera.Position = new Vector3(0, 0, 50);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _targetCamera.SetProjection(45.0f, 0.1f, 5000.0f);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _targetCamera.Update();}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Create a box that we'll attach to the scene graph and render as normal.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _box = new Box("OnScreen box", 50, 50, 50);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _box.Material = ContentManager.Load<Material>("BasicTexture.tem");}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Since render target is a texture, we can set it to the material's effect.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _box.Material.SetParameter("DiffuseMap", _renderTarget);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 RootNode.AddChild(_box);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 protected override void OnUpdate(GameTime time) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Since the cube we'll render to a texture isn't attached to the scene graph, ensure we update it here}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.Update(time);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 protected override void OnRender(IRenderer renderer) \{}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Save the old camera and set the one we'll use to render off screen}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 ICamera oldcam = renderer.CurrentCamera;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 renderer.CurrentCamera = _targetCamera;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Set the render target}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 renderer.SetRenderTarget(_renderTarget);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Render directly (calling Draw/OnDraw would be valid here, since we set the render bucket type to skip and}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //if we wanted to check if the box was in view).}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 _offscreenCube.Render(renderer);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }
\par \pard\plain \ltrpar\s1\ql {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Set the current target to null, this tells the renderer to set the backbuffer as the current target,}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //which is the last swapchain used.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 renderer.SetRenderTarget(null);}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Set the old camera back to the renderer}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 renderer.CurrentCamera = oldcam;}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //Due to the setup in BasicApp, the render queue is sorted/rendered after OnRender() is called, which}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //is when the onscreen box will be rendered, so our render target will be ready and waiting}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch             }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 //to be used as a texture for the shader.}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch         }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 \}}
\par \pard\plain \ltrpar\s1\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\fs24\lang1033\loch\fs24\lang1033 {\rtlch \ltrch\loch     }{\rtlch \ltrch\loch\f0\fs24\lang1033\i0\b0\ltrch\hich\f4\fs20\loch\f4\fs20 \}}
\par \pard\plain \ltrpar\s1\ql\rtlch\afs24\lang255\ltrch\dbch\af5\langfe255\hich\f4\fs20\lang1033\loch\f4\fs20\lang1033 {\rtlch \ltrch\loch\f4\fs20\lang1033\i0\b0 \}}
\par }